from flask import jsonify, Blueprint
import datetime

app = Blueprint('health', __name__)

@app.route('/health', methods=['GET'])
def health_check():
    """
    健康检查接口
    返回服务的基本状态信息
    """
    try:

        return jsonify({
            "status": "healthy",
            "timestamp": datetime.datetime.now(datetime.UTC).isoformat(),
            "service": "Flask Health Check",
            "version": "1.0.0",
            "uptime": "running"
        }), 200

    except Exception as e:
        # 如果有任何异常，返回不健康
        return jsonify({
            "status": "unhealthy",
            "error": str(e),
            "timestamp": datetime.datetime.now(datetime.UTC).isoformat()
        }), 500
